package com.cskaoyan.controller.wx_xd;

import com.cskaoyan.bean.MarketStorage;
import com.cskaoyan.bean.common.BasePageInfo;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.common.CommonData;
import com.cskaoyan.service.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @Author Austin Hsu
 * @Date 2022/9/12 22:29
 */

@RestController
@RequestMapping("wx/storage")
public class UploadController {

    @Autowired
    StorageService storageService;


    @RequestMapping("upload")              //1.上传文件到路径 得到文件名  2.insert插入数据库  3.select返回这条数据
    public BaseRespVo create(MultipartFile file) throws IOException {
        MarketStorage data=storageService.create2(file);
        return BaseRespVo.ok2(data);
    }

}

